Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
@types/command-line-usage
Advanced tools
TypeScript definitions for command-line-usage
@types/command-line-usage provides TypeScript type definitions for the command-line-usage package, which is used to create usage guides for command-line applications. It helps in defining sections, options, and examples to display a well-structured help message.
Defining Sections
This feature allows you to define different sections of the usage guide, such as headers and content. The code sample demonstrates how to create sections for a command-line application, including a header and options.
const commandLineUsage = require('command-line-usage');
const sections = [
{
header: 'My App',
content: 'A brief description of my app.'
},
{
header: 'Options',
optionList: [
{
name: 'help',
typeLabel: '{underline boolean}',
description: 'Display this usage guide.'
},
{
name: 'src',
typeLabel: '{underline file}',
description: 'The input files to process.'
}
]
}
];
const usage = commandLineUsage(sections);
console.log(usage);
Displaying Examples
This feature allows you to include examples in the usage guide. The code sample shows how to add an example section to the usage guide, demonstrating how to run the command-line application with specific options.
const commandLineUsage = require('command-line-usage');
const sections = [
{
header: 'Example',
content: 'node myapp.js --src file.txt'
}
];
const usage = commandLineUsage(sections);
console.log(usage);
Customizing Option Descriptions
This feature allows you to customize the descriptions and type labels for options. The code sample demonstrates how to define options with custom descriptions and type labels, providing more detailed information to the user.
const commandLineUsage = require('command-line-usage');
const sections = [
{
header: 'Options',
optionList: [
{
name: 'verbose',
description: 'Enable verbose mode.'
},
{
name: 'timeout',
typeLabel: '{underline ms}',
description: 'Timeout value in milliseconds.'
}
]
}
];
const usage = commandLineUsage(sections);
console.log(usage);
Commander is a popular package for building command-line interfaces. It provides a comprehensive set of features for parsing command-line arguments, defining commands, and generating help messages. Compared to command-line-usage, Commander offers more functionality for command parsing and execution.
Yargs is another widely-used package for building command-line tools. It focuses on parsing arguments and generating user-friendly help messages. Yargs provides a rich set of features for handling complex command-line interfaces, making it a strong alternative to command-line-usage.
Oclif is a framework for building command-line interfaces with a focus on modularity and extensibility. It provides a robust set of tools for creating CLI applications, including argument parsing, command handling, and help generation. Oclif is more feature-rich and structured compared to command-line-usage.
npm install --save @types/command-line-usage
This package contains type definitions for command-line-usage (https://github.com/75lb/command-line-usage#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/command-line-usage.
These definitions were written by matrumz, and Andrija Dvorski.
FAQs
TypeScript definitions for command-line-usage
We found that @types/command-line-usage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.